//---------------------------------------------------------------------
// <copyright file="AmbiguousFunctionImportBinding.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------

using System.Linq;
using Microsoft.Data.Edm.Expressions;

namespace Microsoft.Data.Edm.Library.Internal
{
    internal class AmbiguousFunctionImportBinding : AmbiguousBinding<IEdmFunctionImport>, IEdmFunctionImport
    {
        public AmbiguousFunctionImportBinding(IEdmFunctionImport first, IEdmFunctionImport second)
            : base(first, second)
        {
        }

        public IEdmTypeReference ReturnType
        {
            get { return null; }
        }

        public IEdmEntityContainer Container
        {
            get
            {
                IEdmFunctionImport first = this.Bindings.FirstOrDefault();
                return first != null ? first.Container : null;
            }
        }

        public System.Collections.Generic.IEnumerable<IEdmFunctionParameter> Parameters
        {
            get
            {
                IEdmFunctionImport first = this.Bindings.FirstOrDefault();
                return first != null ? first.Parameters : Enumerable.Empty<IEdmFunctionParameter>();
            }
        }

        public EdmContainerElementKind ContainerElementKind
        {
            get { return EdmContainerElementKind.FunctionImport; }
        }

        public IEdmExpression EntitySet
        {
            get { return null; }
        }

        public bool IsSideEffecting
        {
            get { return true; }
        }

        public bool IsComposable
        {
            get { return false; }
        }

        public bool IsBindable
        {
            get { return false; }
        }

        public IEdmFunctionParameter FindParameter(string name)
        {
            IEdmFunctionImport first = this.Bindings.FirstOrDefault();
            return first != null ? first.FindParameter(name) : null;
        }
    }
}
